﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Shop4Aggies.Data_Access;

namespace Shop4Aggies
{
    public partial class Shipping : System.Web.UI.Page
    {
        public static string SHIPPING_OBJECT_KEY = "ShippingObj";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.Redirect("Account/Login.aspx?ReturnUrl=~/Shipping.aspx");
            }

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {               
               
                Data_Access.Shipping shipping = new Data_Access.Shipping();
                shipping.FirstName = tbFirstName.Text;
                shipping.LastName = tbLastName.Text;
                shipping.Address = tbAddress.Text;
                shipping.City = tbCity.Text;
                shipping.Country = tbCountry.Text;
                shipping.State = tbState.Text;
                shipping.Zip = tbPostalCode.Text;

                if (RadioButton1.Checked)
                    shipping.Method = "STD";
                else if (RadioButton2.Checked)
                    shipping.Method = "EPD";
                else
                    shipping.Method = "EXP";


                Session[SHIPPING_OBJECT_KEY] = shipping;


                Response.Redirect("~/Billing.aspx", false);

               
            }
            catch(Exception exp)
            {
                throw new Exception("ERROR: Processing Shipping Page - " + exp.Message.ToString(), exp);
            }
            finally
            {

            }


        }
        


   
    }

    

}